package com.learn.testReflect;
import org.junit.Test;

import java.lang.reflect.Field;

public class MyTest {

    @Test
    public void test1() throws Exception {
        Class<Person> personClass = Person.class;
        Person person = personClass.newInstance();
        Field[] declaredFields = personClass.getDeclaredFields();
//        for (Field declaredField : declaredFields) {
//            System.out.println(declaredField);
//        }

        Class<?>[] interfaces = personClass.getInterfaces();
        for (Class<?> anInterface : interfaces) {
            System.out.println(anInterface.getName());
        }


        Class<MySun> mySunClass = MySun.class;
        MySun mySun = mySunClass.newInstance();
        Field[] fields = mySunClass.getFields();
        for (Field field : fields) {
            System.out.println(field);
        }


    }
}
